﻿<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>广州商学院lms-登录</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            background: linear-gradient(140deg,#4F6886,#2E4B62);
        }
        .box{
            width: 500px;
            height: 380px;
            margin: 100px auto;
            background: #FEFEFE;
            border-radius: 2px 100px 2px 100px;
            box-shadow: 6px 22px 14px #244763;
        }
        .box h4{
            position: relative;
            top: 20px;
            left: 30px;
        }
        .content{
            width: 420px;
            margin: 44px 0px 0px 12px;
            /*border: 1px solid#ccc;*/
            text-align: center;
        }
        .return{
            width: 70px;
            height: 26px;
            background: #FFFFFF;
            border-radius: 2px;
            color: #353535;
            border: 1px solid #EEEEEE;
            font-size: 12px;
        }
        .zhuce{
            width: 70px;
            height: 26px;
            background: #3A73A0;
            border-radius: 2px;
            color: #FFF;
            border: 0;
            font-size: 12px;
        }
        .zhuce:hover{
            cursor: pointer;
        }
    </style>
    <script type="text/javascript" src="/static/lib/layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/lib/layui/css/layui.css"/>
    <script type="text/javascript" src="/static/js/jquery.js"></script>
</head>
<body>
    <div class="box">
        <h4>广州商学院-实验室管理系统</h4>
        <div class="content">
            <h2 style="margin-bottom: 30px;margin-left: 70px"><b>登录</b></h2>
            <form action="" method="post">
            
            <div class="layui-form-item">
                <label for="" class="layui-form-label">学号</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="username" placeholder="请输入学号">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">密码</label>
                <div class="layui-input-block">
                    <input type="password" class="layui-input" name="password" placeholder="请输入密码">
                </div>
            </div>
            
            </div>
            
            
            <div style="text-align: right;margin-top: 20px;">
                <button type="button" class="return">
                    <a href="{:url('regist')}">注册</a></button>
                <button type="button" class="zhuce">登录</button>
            </div>
            </form>
        </div>
    </div>
</body>
<script>
    $('.zhuce').click(function(){
        $.ajax({
            url:"{:url('login')}",
            type:'post',
            datatype:'json',
            data:$('form').serialize(),
            success:function(data){
                if (data.statu==200) {
                    layui.use('layer',function(){
                        var layer=layui.layer;
                        layer.msg(data.msg,function(){
                            window.location.href="/";
                        });
                    })
                }else{
                    layui.use('layer',function(){
                        var layer=layui.layer;
                        layer.msg(data.msg);
                        $("#img").src=$("#img").src+'?'+Math.random();
                    })
                }
                // console.log(data)
            }
        })
    })
</script>
</html>